//
//  TableViewController2.m
//  CostomCell
//
//  Created by student on 16/3/7.
//  Copyright © 2016年 niit. All rights reserved.
//

#import "TableViewController2.h"
#import "TableViewCell2.h"

@interface TableViewController2 ()

@property(nonatomic,strong)NSArray *list;
@end

@implementation TableViewController2

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.list=@[@{@"Name":@"MacPro",
                  @"Icon":@"macpro.jpg",
                  @"Color":@"White"},
                @{@"Name":@"iMac",
                  @"Icon":@"imac.jpg",
                  @"Color":@"Black"},
                @{@"Name":@"MacBook Air",
                  @"Icon":@"macbookair.jpg",
                  @"Color":@"Sliver"},
                @{@"Name":@"Mac mini",
                  @"Icon":@"macmini.jpg",
                  @"Color":@"Sliver"},
                @{@"Name":@"MacBookpro",
                  @"Icon":@"macbookpro.jpg",
                  @"Color":@"Sliver"}];
    self.tableView.rowHeight=140;
    UINib *nib=[UINib nibWithNibName:@"TableViewCell2" bundle:nil];
    [self.tableView registerNib:nib forCellReuseIdentifier:@"Cell"];
}





- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.list.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    TableViewCell2 *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];

    NSDictionary *d=self.list[indexPath.row];
    cell.icoImageView.image=d[@"Icon"];
    cell.nameLable.text=d[@"Name"];
    cell.colorLable.text=d[@"Color"];
    
    
    return cell;
}




@end
